﻿@*@model IEnumerable<IceDog.DNF.Program.Mvc5.Models.SystemUser>*@
@model PagedList.IPagedList<IceDog.DNF.Program.Mvc5.Models.SystemUser>
@using PagedList.Mvc;
<link href="~/Content/PagedList.css" rel="stylesheet" />
<style>
    table {
    }

    tr {
    }

    th, td {
        border-bottom: 1px solid orange;
        border-right: 1px solid green;
        margin: 0;
        min-width: 100px;
        padding: 10px;
        border-spacing: 0;
    }
</style>
<div class="well" style="margin-top:10px;">
    <div>
        @Html.ActionLink("添加用户", "Create")
        <div>
            @using (Html.BeginForm("Index", "Account", FormMethod.Get))
            {
                @Html.Label("查找姓名")
                @Html.TextBox("SearchString",ViewBag.searchString as string);
                <input type="submit" value="查询" />
            }
        </div>
    </div>
    <table>
        <thead>
        @*<tr>
            <th>@Html.DisplayNameFor(model => model)</th>
            <th>
                @Html.DisplayNameFor(model => model.UserName)
                @Html.ActionLink("排序", "Index", new { ViewBag.sortOrder, ViewBag.searchString })
            </th>
            <th>@Html.DisplayNameFor(model => model.Password)</th>
            <th>@Html.DisplayNameFor(model => model.Email)</th>
            <th>操作</th>
        </tr>*@
        <tr>
            <th>编号</th>
            <th>
                用户名
                @Html.ActionLink("排序", "Index", new { ViewBag.sortOrder, ViewBag.searchString })
            </th>
            <th>密码</th>
            <th>邮箱</th>
            <th>操作</th>
        </tr>
        </thead>
        <tbody>
        @foreach (var item in Model)
        {
            <tr>
                @* modelItem 参数只是占位置，不起任何作用 *@
                <td>@Html.DisplayFor(modelItem => item.Id)</td>
                <td>@Html.DisplayFor(modelItem => item.UserName)</td>
                <td>@Html.DisplayFor(modelItem => item.Password)</td>
                <td>@Html.DisplayFor(modelItem => item.Email)</td>
                <td>
                    @Html.ActionLink("编辑", "Edit", new { id = item.Id }) |
                    @Html.ActionLink("删除", "Delete", new { id = item.Id })|
                    @Html.ActionLink("详情", "Details", new { id = item.Id })
                </td>
            </tr>
        }
        </tbody>
    </table>
    <div>
        (@(Model.PageCount < Model.PageNumber ? 0 : Model.PageNumber) / @Model.PageCount)
        @Html.PagedListPager(Model, pageNumber => Url.Action("Index", new { pageNumber, ViewBag.searchString }))
    </div>
</div>
